<?php 
// no direct access
defined('_JEXEC') or die;
$uriPrefix = JMvmuri::prefix();

?>
{ 	"cart_url" : <?php echo json_encode(JURI::root() . 'index.php?option=com_mvm&task=cart.cart&view=cart&format=json'); ?>,

<?php $len = count($this->results); $i=0; ?>
	"products" : 
	[
<?php if ($this->results) {?>	
<?php foreach($this->results as $product) : ?>
<?php $i++;?>
		{
			"name" : <?php echo json_encode($product->product_name);?>,
			"id" : <?php echo json_encode($product->product_id);?>,
			"url" : <?php echo json_encode( $uriPrefix . JRoute::_( 'index.php?option=com_mvm&view=product&format=json&product_id='.$product->product_id)); ?>,
			"image_filename" : "<?php echo ( $product->product_full_image);?>",
			"image_filename_thumb" : "<?php echo ($product->product_thumb_image);?>",
			"image_url_thumb" : <?php echo json_encode(JURI::root().IMAGEURL.'product/'.$product->product_thumb_image); ?>,
			"image_url" : <?php echo json_encode( JURI::root().IMAGEURL.'product/'.$product->product_full_image);?>,
			"desc" : <?php echo json_encode($product->product_s_desc); ?>
	<?php if (_SHOW_PRICES == '1') {?>,
			'salesPrice' : <?php echo json_encode($product->prices['salesPrice']); ?>,
			'basePrice' : <?php echo json_encode($product->prices['basePrice']); ?>,
			'basePriceVariant' : <?php echo json_encode($product->prices['basePriceVariant']); ?>,
			'basePriceWithTax' : <?php echo json_encode($product->prices['basePriceWithTax']); ?>,
			'discountedPriceWithoutTax' : <?php echo json_encode($product->prices['discountedPriceWithoutTax']); ?>,
			'priceBeforeTax' : <?php echo json_encode($product->prices['priceBeforeTax']); ?>,
			'taxAmount' : <?php echo json_encode($product->prices['taxAmount']); ?>,
			'discountAmount' : <?php echo json_encode($product->prices['discountAmount']); ?>,
			'priceWithoutTax' : <?php echo json_encode($product->prices['priceWithoutTax']); ?>,
			'subtotal' : <?php echo json_encode($product->prices['subtotal']); ?>,
			'subtotal_tax_amount' : <?php echo json_encode($product->prices['subtotal_tax_amount']); ?>,
			'subtotal_discount' : <?php echo json_encode($product->prices['subtotal_discount']); ?>,
			'sobtotal_with_tax' : <?php echo json_encode($product->prices['subtotal_with_tax']); ?>,
		    'currency': <?php echo json_encode($featProduct->prices['vendorCurrency'])?>,
			'add_one_to_basket_url' : <?php echo json_encode(JURI::root().'?option=com_mvm&task=cart.add&view=cart&quantity=1&format=json&product_id='. $product->product_id);?>
	
		}<?php 
			
	} if ($i < $len) echo "," ?>
		
<?php endforeach; ?>
<?php } // end if !empty result?>
	]
}
